package training.collections;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class ArrayLimitations {
	
	int[] numbers = new int[]{10,5,4,3,12,2,1,89};
	float floats[] =new float[10];
	
	float floatsin2D[][] = new float[10][5];
	int numbersin2D[][] =  new int[][]{{1,3,5,10},{45,23,12},{3}}; //2x4
	
	public void arrayDemo(){
		System.out.println(numbersin2D.length);
		System.out.println(numbersin2D[0].length);
		System.out.println(numbersin2D[1].length);
		System.out.println(numbersin2D[2][0]);
		
	}
	
	public void collectionsDemo(){
		Collection collection ;
	}
	
	public void setDemo(){
	
	//you should never use concrete types when possible
	//HashSet mySet = new HashSet(); //wrong way of doing it
	Set myNumbersSet = new HashSet();
	myNumbersSet.add(10);
	myNumbersSet.add(15);
	myNumbersSet.add(5);
	myNumbersSet.add(10);
	myNumbersSet.add(6);
	myNumbersSet.add("Java training");
	
	System.out.println(myNumbersSet);
		
	}
	
	public void ListDemo(){
		
		List myList = new ArrayList();
		
		myList.add(10);
		myList.add(15);
		myList.add(5);
		myList.add(10);
		myList.add(6);
		myList.add("Java training");
		myList.add(3,7);
		
		System.out.println(myList);
		System.out.println("Eelemnt in myList at 0th position :" + myList.get(0));
		System.out.println("Eelemnt in myList at 5th position :" + myList.get(5));
		
	}
	
	public void MapDemo(){
		Map myMap = new HashMap();
		myMap.put("Hari", 100);
		myMap.put("Nisha", 110);
		myMap.put("Ambika", 120);
		
	}

	public static void main(String[] args) {
		
		ArrayLimitations arrays = new ArrayLimitations();
		//arrays.arrayDemo();
		
		arrays.setDemo();
		arrays.ListDemo();
	}

}
